'use strict';


// 根据id获取指定商品
function getByid(id) {
    return new Promise(function (abc, bbc) {
        $.get(`http://localhost:3000/blog/${id}`, data => {
            abc(data);
        })
    })
}




//删除
function deleted(id) {
    let Ddel = confirm(`确定要删除吗？`);
    if (Ddel) {
        $.ajax({
            url: `http://localhost:3000/del`,
            data: { id },
            type: 'post',
            success: () => {
                window.location.href = "./index.html"
            }
        })
    }
}

//保存
function save() {
    let obj = {
        biaoti: $('#biaoti').val(),
        zhaiyao: $('#zhaiyao').val(),
        neirong: $('#neirong').val(),
        fenlei: $('#fenlei').val(),
        zuozhe: $('#zuohze').val(),
        fabiaoshijian: $('#fabiaoshijian').val()
    }
    console.log(obj);
    $.post(`http://localhost:3000/save`, obj, () => {
        window.location.href = './index.html'
    })
}

//编辑





